package com.huaxin.hxmoduleworkorder.models;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.huaxin.hxenum.enums.Unit;
import com.huaxin.hxmoduleworkorder.common.StringListToJsonTypeHandler;
import com.huaxin.hxmoduleworkorder.common.enums.CustomerType;
import com.huaxin.hxmoduleworkorder.common.enums.InspectionOrderItemResultStatus;
import com.huaxin.hxmoduleworkorder.common.enums.InspectionTemplateItemType;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

@Data
@TableName(value = "inspection_order_item", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
public class InspectionOrderItem extends BaseModel {
    @TableField(value = "inspection_order_id")
    @Schema(description = "所属巡查工单ID", example = "ins_order_001")
    private String inspectionOrderId;

    @TableField(value = "customer_type")
    @Schema(description = "客户类型：commercial/residential", example = "commercial")
    private CustomerType customerType;

    @TableField(value = "customer_id")
    @Schema(description = "客户ID", example = "cust_001")
    private String customerId;

    @TableField(value = "electrical_room_id")
    @Schema(description = "所属配电房ID", example = "room_001")
    private String roomId;

    @TableField(value = "electrical_cabinet_id")
    @Schema(description = "所属配电箱ID", example = "cab_001")
    private String cabinetId;

    @TableField(value = "name")
    @Schema(description = "名称", example = "电表读数是否正常")
    private String name;

    @TableField(value = "type")
    @Schema(description = "类型：check/measure/photo", example = "photo")
    private InspectionTemplateItemType type;

    @TableField(value = "input_hint")
    @Schema(description = "填写提示", example = "请拍摄电表当前读数照片")
    private String inputHint;

    @TableField(value = "unit")
    @Schema(description = "单位", example = "V")
    private Unit unit;

    @TableField(value = "standard_value")
    @Schema(description = "标准值", example = "220V±5%")
    private String standardValue;

    @TableField(value = "result_status")
    @Schema(description = "检查结果状态：pending/normal/abnormal", example = "pending")
    private InspectionOrderItemResultStatus resultStatus;

    @TableField(value = "actual_value")
    @Schema(description = "实际值（填写或拍照路径）", example = "218V")
    private String actualValue;

    @TableField(value = "remarks")
    @Schema(description = "备注或问题描述", example = "电压偏低，建议检查线路")
    private String remarks;
    
    @Schema(description = "备注图片URL列表", example = "[\"https://oss/1.jpg\",\"https://oss/2.jpg\"]")
    @TableField(value = "remark_images")
    private String remarkImages;

    @Schema(description = "照片URL列表", example = "[\"https://oss/1.jpg\",\"https://oss/2.jpg\"]")
    @TableField(value = "photo_urls", typeHandler = StringListToJsonTypeHandler.class)
    private List<String> photoUrls;

    @TableField(value = "sequence")
    @Schema(description = "排序", example = "1")
    private Integer sequence;
}

